<?php
session_start();
$order_user = $_SESSION['userid'];
date_default_timezone_set('prc');

$tableOrder = "orderlist";

 

$admin_year = date('Y');
$admin_month = date('m');
$admin_days = date('d');


$hour = date('H');


 
if($hour<10)
{$admin_ats=1;}
else if((10<=$hour)and($hour<=15))
{$admin_ats=2;}
else
{$admin_ats=3;}

 
	
$searchStr = $admin_year."年".$admin_month."月".$admin_days."日";



 

//计算订餐人总数
$query = mysql_query("SELECT COUNT(distinct(user_id))  FROM orderlist where (order_date = '$searchStr' and order_at='$admin_ats')");
$order_sum = mysql_result($query, 0);


//计算已经就餐的人数
$query = mysql_query("SELECT COUNT(distinct(user_id)) FROM orderlist where order_date = '$searchStr' and search_status != '0' and order_at='$admin_ats' ");
$order_sum_ed = mysql_result($query, 0);




//获取实际数据     
 	
        $result = mysql_query("select * from $tableOrder where (order_date='$searchStr' and order_at='$admin_ats') group by user_name order by search_status,nid ") ;
     
 
    while ($row = mysql_fetch_array($result)) {
        $search_name[] = $row['product_name'];
        $search_num[] = $row['product_num'];
        $search_at[] = $row['order_at'];
        $search_user_name[] = $row['user_name'];
		$search_status[] = $row['search_status'];
		$search_user_department[] = $row['user_department'];
		
    }
  
 
 $take_away_array=array_count_values($search_user_department);

echo $take_away_num=
$take_away_array["河南营业处"]+
$take_away_array["小岛营业处"]+
$take_away_array["恩州营业处"]+
$take_away_array["腾飞营业处"]+
$take_away_array["平石营业处"]+
$take_away_array["振兴营业处"]+
$take_away_array["合规替班组"];

?>